package com.dianping.cat.consumer.business.model;

import com.dianping.cat.consumer.business.model.transform.DefaultXmlBuilder;
import java.util.Formattable;
import java.util.Formatter;

public abstract class BaseEntity<T>
  extends Object
  implements IEntity<T>, Formattable
{
  public static final String XML = "%.3s";
  public static final String XML_COMPACT = "%s";

  protected void assertAttributeEquals(Object instance, String entityName, String name, Object expectedValue, Object actualValue) {
/* 15 */     if ((expectedValue == null && actualValue != null) || (expectedValue != null && !expectedValue.equals(actualValue))) {
/* 16 */       throw new IllegalArgumentException(String.format("Mismatched entity(%s) found! Same %s attribute is expected! %s: %s.", new Object[] { entityName, name, entityName, instance }));
    }
  }

  protected boolean equals(Object o1, Object o2) {
/* 21 */     if (o1 == null)
/* 22 */       return (o2 == null); 
/* 23 */     if (o2 == null) {
/* 24 */       return false;
    }
/* 26 */     return o1.equals(o2);
  }



  public void formatTo(Formatter formatter, int flags, int width, int precision) {
/* 32 */     boolean compact = (precision == 0);
/* 33 */     DefaultXmlBuilder builder = new DefaultXmlBuilder(compact);

/* 35 */     formatter.format("%s", new Object[] { builder.buildXml(this) });
  }



/* 40 */   public String toString() { return (new DefaultXmlBuilder()).buildXml(this); }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-consumer-3.0.0.jar!/com/dianping/cat/consumer/business/model/BaseEntity.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */